import * as React from 'react';

import {
  useInjectable,
  localize,
  FileUri,
  URI,
  CommandService,
  FILE_COMMANDS,
  IWindowService,
} from '@opensumi/ide-core-browser';
import { ReactEditorComponent } from '@opensumi/ide-editor/lib/browser';
import Layout from './components/layout';
import { BrowserRouter } from "react-router-dom";
import Routes from './routes';
import store from './store/index';
import { Provider } from 'react-redux';

import 'antd/dist/antd.css';
import { setAutoFreeze } from "immer"

// close automatically freezes
setAutoFreeze(false)

export const EditorView: ReactEditorComponent<{query: any}> = ({ resource }) => {

  console.log('showEditorView', resource.metadata?.query)

  React.useEffect(() => {
    console.log(resource.metadata?.query?.name);
  }, [resource.metadata?.query?.name])

  return (
    <Provider store={store}>
      <BrowserRouter basename={'/'}>
        <Routes/>
      </BrowserRouter>
    </Provider>
  );
};
